package cc.admin.modules.graduate.util;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

@Slf4j
public class getFileMD5 {
    public static String getFileMD5(File file){
        try {
            FileInputStream fileInputStream = new FileInputStream(file);
            String fileMD5 = DigestUtils.md5Hex(fileInputStream);
            return fileMD5;
        } catch (IOException e) {
            e.printStackTrace();
        }
        log.error("获取文件md5失败");
        return null;
    }
}
